from django.db import models

# Create your models here.
class User(models.Model):
    METHOD_CHOICES = (
        (1, '启动中'),
        (2, '禁用'),
    )
    user_name = models.CharField('用户名',max_length=20)
    password = models.CharField('密码', max_length=20)
    user_email = models.CharField('用户邮箱', max_length=30)
    nick_name = models.CharField('用户昵称', max_length=30)
    phone = models.CharField('用户电话', max_length=20)
    status = models.IntegerField('用户状态', choices=METHOD_CHOICES, default=1)

    class Meta:
        managed = False
        db_table = 'console_user'

    def __str__(self):
        return str(self.user_name)


class Url_Data(models.Model):
    METHOD_CHOICES = (
        (1, '安全'),
        (2, '危险'),
        (3, '未知'),
    )
    url_name = models.CharField('url地址',max_length=100)
    url_user = models.ForeignKey('User',on_delete=models.CASCADE)
    url_type = models.IntegerField('url安全性', choices=METHOD_CHOICES, default=1)
    url_content = models.CharField('url检测信息',max_length=100)
    url_ip = models.CharField('urlip地址',max_length=30)
    url_address = models.CharField('url所属地址',max_length=30)
    date_time = models.DateField(verbose_name="记录时间", auto_now_add=True)
    def __str__(self):
        return str(self.url_name)

class phone_Data(models.Model):
    METHOD_CHOICES = (
        (1, '安全'),
        (2, '危险'),
        (3, '未知'),
    )
    phone = models.CharField('电话号码',max_length=28)
    phone_address = models.CharField('电话号码属地',max_length=100)
    phone_type = models.IntegerField('电话号码安全性', choices=METHOD_CHOICES ,default=1,max_length=100)
    phon_content = models.CharField('检测信息',max_length=100)
    phone_user = models.ForeignKey('User',on_delete=models.CASCADE)
    date_time = models.DateField(verbose_name="记录时间", auto_now_add=True)
    def __str__(self):
        return str(self.phone)

class fraud(models.Model):
    METHOD_CHOICES = (
        (1, '网络诈骗'),
        (2, '电话诈骗'),
    )
    fraud_name = models.CharField('诈骗名称',max_length=30)
    content = models.TextField('诈骗信息',max_length=100)
    year = models.CharField('发生年份',max_length=100)
    month = models.CharField('发生月份',max_length=100)
    day = models.CharField('发生日期',max_length=100)
    type = models.CharField('诈骗类型',choices=METHOD_CHOICES, default=1,max_length=100)
    money = models.CharField('金额',max_length=100)

    # def __str__(self):
    #     return str(self.fraud_name)

class phone_False(models.Model):
    METHOD_CHOICES = (
        (1, '安全'),
        (2, '危险'),
        (3, '未知'),
    )
    phone = models.CharField('电话号码',max_length=28)
    phone_type = models.IntegerField('电话号码安全性', choices=METHOD_CHOICES, default=1, max_length=100)
    phone_address = models.CharField('电话号码属地',max_length=100)
    phone_content = models.CharField('检测信息',max_length=100)
    def __str__(self):
        return str(self.phone)

class data_False(models.Model):
    METHOD_CHOICES = (
        (1, '安全'),
        (2, '危险'),
        (3, '未知'),
    )
    url = models.CharField('url地址',max_length=100)
    url_type = models.IntegerField('url安全性', choices=METHOD_CHOICES, default=1)
    url_content = models.CharField('url检测信息',max_length=100)
    ip = models.CharField('urlip地址',max_length=30)
    url_address = models.CharField('url所属地址',max_length=30)
    def __str__(self):
        return str(self.url_name)
